package com.svc;

import static org.junit.Assert.*;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.junit.Test;

import com.jdbc.service.SVC_SqlCommandRemote; 
import com.jdbc.service.I_SqlCommand; 

public class test {
	

	public static InitialContext tomee_InitialContext() throws NamingException{
		Properties properties = new Properties();
		 
	    properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");   
        properties.setProperty(Context.PROVIDER_URL, "http://127.0.0.1:8080/tomee/ejb"); 
        return new InitialContext(properties);   
	}
	
	@Test
	public void test() throws NamingException {
		  InitialContext ctx = tomee_InitialContext();    
		  Object ejb =  ctx.lookup("SVC_SqlCommandRemote");
		  System.out.println(ejb);
		  SVC_SqlCommandRemote svc = (SVC_SqlCommandRemote) ejb;
		 System.out.println(svc.execute(I_SqlCommand.DB_EXECUTE_QUERY, I_SqlCommand.RETURN_TYPE_LIST, "SELECT * FROM tb_acm_func","db_dpmc"));
	      
		  
		
	}

}
